<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>layui.form小例子</title>
  <link rel="stylesheet" href="css/layui.css" media="all">
  <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
</head>
<body>
<form class="layui-form"> <!-- 提示：如果你不想用form，你可以换成div等任何一个普通元素 -->

  <div class="layui-form-item layui-form-text">
    <label class="layui-form-label">请填写描述</label>
    <div class="layui-input-block">
      <textarea placeholder="请输入内容" class="layui-textarea"></textarea>
    </div>
  </div>
  <div class="layui-form-item">
    <div class="layui-input-block">
      <button class="layui-btn" lay-submit lay-filter="*">立即提交</button>
      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">下拉选择框</label>
    <div class="layui-input-block">
      <select name="interest" lay-filter="test">
        <option value="0">写作</option>
        <option value="1">阅读</option>
      </select>
    </div>
  </div>
</form>
<script src="layui.js"></script>
<script>
  layui.use('form', function(){
    var form = layui.form;
    form.on('select(test)', function(data){
      console.log(data);
    });
    form.on('submit(*)', function(data){
      console.log(data);
      return false;
    });

  });
</script>
</body>
</html>
